
import request from '@/router/axios'

const prefix = '/rca/swckbankcashpaymentnote';
const tmpDataPrefix = '/rca/swckbankcashpaymentnotetmp'

export function fetchList(query) {
  return request({
    url: prefix+'/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: prefix,
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: prefix+'/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: prefix+'/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: prefix,
    method: 'put',
    data: obj
  })
}

//批量删除现金缴款单
export function delBatch(ids) {
  return request({
    url: prefix +'/delBatch',
    method: 'delete',
    data:ids
  })
}
export function createFares(obj) {
  return request({
    url: prefix+'/getGenerateStationFareDifference',
    method: 'get',
    params: obj
  })
}

// 补卸载金额 和 补短款金额 查询
export function getUnloadShortAmount(query) {
  return request({
    url: prefix+'/getUnloadShortAmount',
    method: 'get',
    params: query
  })
}

// 查询地铁线路
export function listAllSubWayLine(query) {
  return request({
    url: prefix+'/listAllSubWayLine',
    method: 'get',
    params: query
  })
}

// 查询地铁线路下的站点
export function listSubWayStation(query) {
  return request({
    url: `${prefix}/listSubWayStation`,
    method: 'get',
    params: query
  })
}

export const fileData = {

  list: (query)=>{
    return request({
      url: `${tmpDataPrefix}/list`,
      method: 'get',
      params: query
    })
  },
  // upload: (query)=>{
  //   return request({
  //     url: `${tmpDataPrefix}/saveBatch`,
  //     method: 'post',
  //     headers: {
  //       'Content-Type': 'multipart/form-data'
  //     },
  //     data: query
  //   })
  // },
    // 下载模板
  template: (query)=>{
    return request({
      url: `${tmpDataPrefix}/exportTamplate`,
      method: 'get',
      responseType: 'blob',
      params: query
    })
  },
  upload: (query)=>{
    return request({
      url: `${tmpDataPrefix}/saveBatchByTwoDate`,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data: query
    })
  },
  save: (query)=>{
    return request({
      url: `${tmpDataPrefix}/saveBatchOk`,
      method: 'post',
      data: query
    })
  },
  cancel: (query)=>{
    return request({
      url: `${tmpDataPrefix}/saveBatchCancel`,
      method: 'post',
      data: query
    })
  },
}
